/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package net.flowas.materialbilling.domain;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Column;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Temporal;
import net.flowas.os.domain.Position;

/**
 *
 * @author Administrator
 */
@Entity
public class OrderForm implements Serializable {

    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    private Long id;
    //开始配送时间
    @Temporal(javax.persistence.TemporalType.DATE)
    private Date deliverTime;
    //金额
    @Column(name="billing_sum")
    private Float sum;

    //商品总数量
    private Long quantity;
    //备注
    private String note;
    
    @ManyToOne
    private Position position;
    //商品清单
    @OneToMany
    private List<OrderItem> orderItems=new ArrayList<OrderItem>();
    @ManyToOne
    private MemberCard memberCard;
    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof OrderForm)) {
            return false;
        }
        OrderForm other = (OrderForm) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "net.flowas.materialbilling.domain.OrderForm[ id=" + id + " ]";
    }

    /**
     * @return the deliverTime
     */
    public Date getDeliverTime() {
        return deliverTime;
    }

    /**
     * @param deliverTime the deliverTime to set
     */
    public void setDeliverTime(Date deliverTime) {
        this.deliverTime = deliverTime;
    }

    /**
     * @return the sum
     */
    public Float getSum() {
        return sum;
    }

    /**
     * @param sum the sum to set
     */
    public void setSum(Float sum) {
        this.sum = sum;
    }

    /**
     * @return the quantity
     */
    public Long getQuantity() {
        return quantity;
    }

    /**
     * @param quantity the quantity to set
     */
    public void setQuantity(Long quantity) {
        this.quantity = quantity;
    }

    /**
     * @return the note
     */
    public String getNote() {
        return note;
    }

    /**
     * @param note the note to set
     */
    public void setNote(String note) {
        this.note = note;
    }

    /**
     * @return the position
     */
    public Position getPosition() {
        return position;
    }

    /**
     * @param position the position to set
     */
    public void setPosition(Position position) {
        this.position = position;
    }

    /**
     * @return the orderItems
     */
    public List<OrderItem> getOrderItems() {
        return orderItems;
    }

    /**
     * @param orderItems the orderItems to set
     */
    public void setOrderItems(List<OrderItem> orderItems) {
        this.orderItems = orderItems;
    }

    /**
     * @return the memberCard
     */
    public MemberCard getMemberCard() {
        return memberCard;
    }

    /**
     * @param memberCard the memberCard to set
     */
    public void setMemberCard(MemberCard memberCard) {
        this.memberCard = memberCard;
    }

}
